package common

import (
	"context"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
)

func NewMongo() *mongo.Database {
	uri := "mongodb://blockchain_rw:uCu8A&tJND@10.44.27.77:27017/?retryWrites=false"
	databaseName := "blockchain"

	client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))

	if err != nil {
		panic(err)
	}

	return client.Database(databaseName)
}
